document.write('<script type="text/javascript" src="js/dialogBase.js"></script>');
//手动提交订单
create_api = function (orderid) {
	art.dialog.confirm('确定手动提交订单，并创建？',
			function(){
				$.ajax({
					url : './plane/order_create.shtml',
					cache : false,
					type : 'POST',
					data : {'childid' : orderid	},
					loading:art.dialog({
						title : '系统提示',
						id:'ca_'+orderid,
						content:'订单正在处理中，请等待……'
					}),
					success : function(data) {
						var result = '';
						if (data == '0') {
							result = '订单提交成功';
						} else {
							result = data;
						}
						closeAllDialog();
						art
								.dialog({
									lock: true,
									title : '系统提示',
									content : ''
											+ result
											+ '，2秒后关闭……',
									time : 2,
									close : function() {
										location.reload();
									}
								});
					}
				});
			},
			function(){closeAllDialog();});
	/*art
			.dialog({
				title : '系统提示',
				id : 'create_' + orderid,
				content : '确定手动提交订单，并创建？',
				ok : function() {
					$.ajax({
						url : './plane/order_create.shtml',
						cache : false,
						type : 'POST',
						data : {
							'childid' : orderid
						},
						loading : this
								.content('订单正在处理中，请等待……'),
						success : function(data) {
							var result = '';
							if (data == '0') {
								result = '订单提交成功';
							} else {
								result = data;
							}
							closeAllDialog();
							art
									.dialog({
										lock: true,
										title : '系统提示',
										content : ''
												+ result
												+ '，2秒后关闭……',
										time : 2,
										close : function() {
											location.reload();
										}
									});
						}
					});
					return false;
				},
				cancel : true
			});*/
};
//更改政策
changePolicy=function(cid) {
	var dialog = art.dialog({
		title : '系统提示',
		id:'cp_' + cid,
		width:'100%',
		content : '正在获取数据……'
	});
	$.ajax({
		url : './plane/policy_getPoliciesForOrder.shtml',
		data : {
			'cid' : cid
		},
		success : function(data) {
			dialog.content(data);
		},
		cache : false
	});
};
// 办理改签
gaiQian = function (cid){
	var dialog = art.dialog({
		title : '系统提示',
		id:'gq_' + cid,
		content : '正在获取数据……'
	});
	$.ajax({
		url:'./plane/planeGaiqian_doSearchInfo.shtml',
		type:'POST',
		cache:false,
		loading:dialog.content('订单正在处理中，请等待……'),
		data:{cid:cid},
		success:function(data){
			dialog.content(data);
		}
	});
};
// 办理升舱
riseCabin = function (cid){
	var dialog = art.dialog.through({
		title : '系统提示',
		id:'rc_' + cid,
		content : '正在获取数据……'
	});
	$.ajax({
		url:'./plane/rise_getRiseCabinInfo.shtml',
		type:'POST',
		loading:dialog.content('订单正在处理中，请等待……'),
		cache:false,
		data:{cid:cid},
		success:function(data){
			dialog.content(data);
		}
	});
};
// 手动订单
ticketManager = function(cid){
	var dialog = art.dialog({
		title : '系统提示',
		id:'tm_' + cid,
		content : '正在获取数据……'
	});
	$.ajax({
		url:'./plane/order_getObjectForSyn.shtml',
		type:'POST',
		data:{cid:cid},
		cache:false,
		success:function(result){
			dialog.content(result);
		}
	});
};
refreshOrder = function(cid){
	var dialog = art.dialog({
		title : '系统提示',
		id:'tm_' + cid,
		content : '正在获取数据……'
	});
	$.ajax({
		url:'./plane/order_refreshOrder.shtml',
		type:'POST',
		data:{cid:cid},
		cache:false,
		success:function(result){
			if(result=="success"){
				location.reload();
			}else{
				dialog.content(result).time(2);
			}
		}
	});
}
// 发送出票短信
ticketSms = function(cid){
	var dialog = art.dialog({
		title : '系统提示',
		id:'rc_' + cid,
		content:'正在提交请求……',
		lock:true
	});
	$.ajax({
		url:'./plane/smsNotice_ticketNotice.shtml',
		type:'POST',
		cache:false,
		loading:dialog.content('请求正在处理中，请等待……'),
		data:{cid:cid},
		success:function(result){
			if(result=='T'){
				dialog.content("短信发送成功").time(3);
				location.url = location.href;
			}
		}
	});
};
orderLock = function(oid,locked,url){
	var dialog = art.dialog({
		title : '系统提示',
		id:'rc_' + oid,
		content:'正在提交请求……',
		lock:true
	});
	$.ajax({
		url:'./plane/p_lock_lock.shtml',
		type:'POST',
		cache:false,
		loading:dialog.content('请求正在处理中，请等待……'),
		data:{oid:oid},
		success:function(result){
			if(result!='1'){
				dialog.content(result).time(3);
				location.reload();
			}else{
			switch(locked)
				{
					case 0:
							location.href='./plane_list.shtml';
					break;
					case 1:
						if(url==''){location.reload();}
						else{location.href=url;}
					break;
				}
			}
		}
	});
};
// 自动扣款
autopay = function(cid){
	art.dialog.confirm('确认后，平台将会自动进行扣款……',
	function(){
		$.ajax({
			url:'./plane/order_autoPay.shtml',
			type:'POST',
			data:{cid:cid},
			cache:false,
			loading:art.dialog({
				title : '系统提示',
				id:'ap_'+cid,
				content:'订单正在处理中，请等待……'
			}),
			success:function(result){
				if(result=='T'){
					result = "支付成功，等待系统出票……";
				}
				if(/(-)?\d+/.test(result)){
					result = "支付失败【"+result+"】,请联系管理员……";
				}
				closeAllDialog();
				art.dialog({title : '系统提示',
					content : ''+ result + '，2秒后关闭……',
					time : 2,
					close : function() {
							location.reload();
							}
					});
			}
		});
	},
	function(){closeAllDialog();});
};
//办理退废
tuifei=function(cid){
	var dialog = art.dialog({
		title:'系统提示',
		id:'tf_'+cid,
		content:'正在提交请求……'
	});
	$.ajax({
		url:'./plane/tuifei_getTuifeiInfo.shtml',
		type:'POST',
		cache:false,
		data:{cid:cid},
		success:function(result){
			dialog.content(result);
		}
	});
};
// 退废对账
tuifeiRecon=function(rid){
	var dialog = art.dialog({
		title:'系统提示',
		id:'tfr_'+rid,
		content:'正在提交请求……'
	});
	$.ajax({
		url:'./plane/finace_refound_refundRecon.shtml',
		type:'POST',
		cache:false,
		data:{id:rid},
		success:function(result){
			location.reload();
		}
	});
}

// 申请退款
applyRefund = function(id){
	var dialog = art.dialog({
		title:'系统提示',
		id:'tfr_'+id,
		content:'正在提交请求……'
	});
	$.ajax({
		url:'./plane/plane_getObject.shtml',
		type:'POST',
		cache:false,
		data:{id:id},
		success:function(result){
			dialog.content(result);
		}
	});
}
